#
from google.appengine.ext import db
from google.appengine.ext.db import djangoforms


class Settings(db.Model):
  user = db.UserProperty()
  employer_emails = db.StringProperty()
  come_title = db.StringProperty()
  come_text = db.StringProperty(multiline=True)
  gone_title = db.StringProperty()
  gone_text = db.StringProperty(multiline=True)

class SettingsForm(djangoforms.ModelForm):
  def __init__ (self, *args, **kwargs):
    super(SettingsForm, self).__init__(*args, **kwargs)
    self.fields['employer_emails'].label = 'Employer email(s)'
  #      self.fields['employer_emails'].required = True
    self.fields['come_text'].widget.attrs['rows'] = 4
    self.fields['gone_text'].widget.attrs['rows'] = 4
  class Meta:
    model = Settings
    exclude = ['user']

class Users(db.Model):
  user = db.UserProperty()
  username = db.StringProperty()
  work_status = db.BooleanProperty()
  auth_token = db.StringProperty()
  date_created = db.DateTimeProperty()
  lang = db.StringProperty()

class UserForm(djangoforms.ModelForm):
  def __init__ (self, *args, **kwargs):
    super(UserForm, self).__init__(*args, **kwargs)
    self.fields['username'].required = True
  class Meta:
    model = Users
    exclude = ['user', 'work_status', 'auth_token']
        
class Timeline(db.Model):
    user = db.UserProperty()
    date_start = db.DateTimeProperty()
    date_finish = db.DateTimeProperty()
    tz_offset = db.StringProperty(default='00:00')